__author__ = 'zoulida'

import pymysql


def queryMySQL():
    ###########################查询刚才操作的成果##################################

    # 重新建立数据库连接
    db = pymysql.connect(host='localhost', user = 'root', password = "root", charset='utf8')
    cursor = db.cursor()
    sqlSentence2 = "use stockDataBase;"
    cursor.execute(sqlSentence2)
    # 查询数据库并打印内容
    cursor.execute('select * from stock_600519')
    results = cursor.fetchall()
    for row in results:
        print(row)
    # 关闭
    cursor.close()
    db.commit()
    db.close()

if __name__ == '__main__':
    queryMySQL()